<?php
	require '../include/library.inc.php';
	
	$ip = $_SERVER["REMOTE_ADDR"];
	
	$sql = "SELECT ip FROM image_likes WHERE album_id = '".intval($_POST['album'])."' AND iamge = '".$_POST['image']."' AND ip = '".$ip."'";
	$likes = query($sql);
	
	
	if(mysql_numrows($likes))
	{
		echo image_likes(intval($_POST['album']),$_POST['image']);
	}else{
		
			
			$sql2 = "INSERT INTO image_likes
					(album_id,iamge,ip)
					VALUES
					('".intval($_POST['album'])."','".$_POST['image']."','".$ip."')";
			query($sql2);
					
		echo image_likes(intval($_POST['album']),$_POST['image']);
	}
	
	
?>